home *** CD-ROM | disk | FTP | other *** search
-
-
-
- xxxxttttaaaallllkkkk((((DDDD3333)))) xxxxttttaaaallllkkkk((((DDDD3333))))
-
-
-
- NNNNAAAAMMMMEEEE
- _x_t_a_l_k - IRIX XIO Infrastructure
- _x_w_i_d_g_e_t__d_r_i_v_e_r__r_e_g_i_s_t_e_r - claim a class of XIO widgets
- _x_w_i_d_g_e_t__d_r_i_v_e_r__u_n_r_e_g_i_s_t_e_r - remove driver from registry
- _x_t_a_l_k__i_t_e_r_a_t_e - revisit all claimed widgets
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- #include <sys/xtalk/xtalk.h>
-
- int
- xwidget_driver_register(
- xwidget_part_num_t _p_a_r_t__n_u_m,
- xwidget_mfg_num_t _m_f_g__n_u_m,
- char *_d_r_i_v_e_r__p_r_e_f_i_x,
- unsigned _f_l_a_g_s);
-
- void
- xwidget_driver_unregister(char *_d_r_i_v_e_r__p_r_e_f_i_x);
-
- void
- xtalk_iterate(
- char *_d_r_i_v_e_r__p_r_e_f_i_x,
- xtalk_iter_f *_f_u_n_c)
-
- AAAArrrrgggguuuummmmeeeennnnttttssss
- _p_a_r_t__n_u_m and _m_f_g__n_u_m
- are the values that the XIO-based device will present in its XIO
- ID register as identification.
-
- _d_r_i_v_e_r__p_r_e_f_i_x
- is the prefix string for the driver's standard functions; the
- infrastructure will use this prefix to locate the driver's cdevsw
- entry, in order to call the driver's attach and detach routines.
-
- _f_l_a_g_s Normally passed as zero.
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- _x_t_a_l_k is the package that drivers for XIO-based devices use to set up
- services for their devices. These services include:
-
- +o locating all instances of the device in the system (documented in
- this page).
-
- +o constructing CPU addresses that the driver can use to do PIO accesses
- to the device (see _x_t_a_l_k__p_i_o(D3)).
-
- +o constructing XIO addresses that the device can use to do DMA accesses
- to memory (see _x_t_a_l_k__d_m_a(D3)).
-
- +o arranging for a function to be called when the device requests
- interrupt service (see _x_t_a_l_k__i_n_t_r(D3)).
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- xxxxttttaaaallllkkkk((((DDDD3333)))) xxxxttttaaaallllkkkk((((DDDD3333))))
-
-
-
- +o arranging for a function to be called when an error occurs during PIO
- to, or DMA from the device (see _x_t_a_l_k__e_r_r_o_r(D3)).
-
- +o accessing useful fields in some otherwise opaque data structures (see
- _x_t_a_l_k__g_e_t(D3)).
-
- DDDDrrrriiiivvvveeeerrrr RRRReeeeggggiiiissssttttrrrraaaattttiiiioooonnnn
- _x_w_i_d_g_e_t__d_r_i_v_e_r__r_e_g_i_s_t_e_r() is used by drivers to inform the infrastructure
- that they are interested in certain XIO-based devices; a relation is kept
- associating the specified part and manufacturer ID numbers with the noted
- device driver prefix. The infrastructure will call the attach routine
- with that driver prefix, passing the hardware graph connection point
- vertex as the only parameter. This _c_o_n_n_e_c_t_i_o_n _p_o_i_n_t is then used in most
- calls to the infrastructure to identify which particular XIO device is of
- interest.
-
- Loadable device drivers should call this function from their _r_e_g() entry
- point. Drivers that are prelinked into the kernel should also make the
- call from _r_e_g() for consistency, but may call from _i_n_i_t() if necessary.
-
- Device drivers may make multiple calls with different vendor and device
- ID numbers, representing several compatible XIO devices.
-
- Wildcard values _X_W_I_D_G_E_T__P_A_R_T__N_U_M__N_O_N_E and _X_W_I_D_G_E_T__M_F_G__N_U_M__N_O_N_E may be
- used if cards from any vendor or cards with any device code are of
- interest; if both vendor and device are wildcarded, the attach routine
- will be called for every XIO device connected to the system.
-
- When a loadable device driver calls _x_w_i_d_g_e_t__d_r_i_v_e_r__r_e_g_i_s_t_e_r(), the calls
- to the driver's _a_t_t_a_c_h() function may occur before the infrastructure
- returns control to the caller. On some large systems, the _a_t_t_a_c_h() calls
- may be executed by other threads and possibly on other processors,
- concurrently with continued execution of the _r_e_g() function.
-
- _x_w_i_d_g_e_t__d_r_i_v_e_r__u_n_r_e_g_i_s_t_e_r() should be called by any unloadable device
- driver, from within the driver's _u_n_r_e_g() function. This will trigger
- calls to the driver's _d_e_t_a_c_h() entry point, and remove any references to
- the driver from the registry table.
-
-
-
- CCCCoooonnnnnnnneeeeccccttttiiiioooonnnn PPPPooooiiiinnnntttt IIIItttteeeerrrraaaattttiiiioooonnnn
- It is sometimes important for driver code to be able to go back and
- revisit each connection point that was passed to its attach routine; the
- best case for this is the disconnecting of interrupt and error handling
- functions before unloading a driver, and the reconnecting of these
- handlers after the driver is reloaded. _x_t_a_l_k__i_t_e_r_a_t_e() provides a quick
- mechanism to have a private function called with each connection point
- that the infrastructure has matched with the specified driver.
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- xxxxttttaaaallllkkkk((((DDDD3333)))) xxxxttttaaaallllkkkk((((DDDD3333))))
-
-
-
- On large systems, the calls may take place in many separate threads on
- many separate processors, so the function to be called needs to use
- appropriate locking when accessing driver-global structures.
-
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
- Here is how a typical driver might make use of these functions:
-
- static char xiofoo_prefix[] = "xiofoo_";
- static char xiofoo_edge[] = "foo";
-
- xiofoo_init(void)
- {
- /* the first time through, we are not
- * registered, so this is a no-op.
- * after that, it triggers reload_me.
- */
- xtalk_iterate(xiofoo_prefix, xiofoo_reload_me);
- }
-
- xiofoo_unload(void)
- {
- ...
- xtalk_iterate(xiofoo_prefix, xiofoo_unload_me);
- ...
- }
-
- xiofoo_reg(void)
- {
- xwidget_driver_register(
- XIOFOO_VENDOR_ID,
- XIOFOO_DEVICE_ID,
- xiofoo_prefix, 0);
- }
-
- xiofoo_unreg(void)
- {
- xwidget_driver_unregister(xiofoo_prefix);
- }
-
- xiofoo_reload_me(vertex_hdl_t conn)
- {
- vertex_hdl_t vhdl;
- xiofoo_soft_t xiofoo_soft;
-
- if (GRAPH_SUCCESS !=
- hwgraph_traverse(conn, xiofoo_edge, &vhdl))
- return;
- xiofoo_soft = hwgraph_fastinfo_get(vhdl);
- if (!xiofoo_soft)
- return;
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- xxxxttttaaaallllkkkk((((DDDD3333)))) xxxxttttaaaallllkkkk((((DDDD3333))))
-
-
-
- if (xiofoo_soft->intr)
- xtalk_intr_connect(xiofoo_soft->intr,
- xiofoo_intr,
- xiofoo_soft);
- }
-
- xiofoo_reload_me(vertex_hdl_t conn)
- {
- vertex_hdl_t vhdl;
- xiofoo_soft_t xiofoo_soft;
-
- if (GRAPH_SUCCESS !=
- hwgraph_traverse(conn, xiofoo_edge, &vhdl))
- return;
-
- xiofoo_soft = hwgraph_fastinfo_get(vhdl);
- if (!xiofoo_soft)
- return;
-
- if (xiofoo_soft->intr)
- xtalk_intr_connect(xiofoo_soft->intr,
- xiofoo_intr,
- xiofoo_soft);
- }
-
- xiofoo_unload_me(vertex_hdl_t conn)
- {
- vertex_hdl_t vhdl;
- xiofoo_soft_t xiofoo_soft;
-
- if (GRAPH_SUCCESS !=
- hwgraph_traverse(conn, xiofoo_edge, &vhdl))
- return;
- xiofoo_soft = hwgraph_fastinfo_get(vhdl);
- if (xiofoo_soft->intr)
- xtalk_intr_disconnect(xiofoo_soft->intr);
- }
-
-
-
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- xtalk_dma(D3), xtalk_error(D3), xtalk_get(D3), xtalk_intr(D3),
- xtalk_pio(D3).
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-